import { defineStore } from 'pinia';
import { store } from '@/store';

type MenuItem = {
  openKeys: string[];
  selectedKeys: string[];
};

export const useMenuStore = defineStore('app-menu', {
  state: (): MenuItem => ({
    openKeys: ['Dashboard'],
    selectedKeys: ['Home']
  }),
  getters: {
  },
  actions: {
    setMenuKeys(openKey: [], selectedKey: string) {
      this.openKeys = [];
      this.openKeys = openKey;
      this.selectedKeys = [];
      this.selectedKeys.push(selectedKey);
    }
  },
});

export function useMenuStoreWidthOut() {
  return useMenuStore(store);
}
